home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.n / open.n < prev    next >
Text File  |  1995-07-25  |  8KB  |  199 lines

  1.  
  2.  
  3.  
  4.      ooooppppeeeennnn((((nnnn))))                     TTTTccccllll ((((7777....0000))))                     ooooppppeeeennnn((((nnnn))))
  5.  
  6.  
  7.  
  8.      _________________________________________________________________
  9.  
  10.      NNNNAAAAMMMMEEEE
  11.           open - Open a file
  12.  
  13.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  14.           ooooppppeeeennnn _f_i_l_e_N_a_m_e ?_a_c_c_e_s_s? ?_p_e_r_m_i_s_s_i_o_n_s?                          |
  15.      _________________________________________________________________
  16.  
  17.  
  18.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  19.           This command opens a file and returns an identifier that may
  20.           be  used  in future invocations of commands like rrrreeeeaaaadddd, ppppuuuuttttssss,
  21.           and cccclllloooosssseeee.  _F_i_l_e_N_a_m_e gives the name of the file to open;  if
  22.           it  starts with a tilde then tilde substitution is performed
  23.           as described for TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt.  If the first character  of
  24.           _f_i_l_e_N_a_m_e  is ``|'' then the remaining characters of _f_i_l_e_N_a_m_e
  25.           are treated as a command pipeline to  invoke,  in  the  same
  26.           style as for eeeexxxxeeeecccc.  In this case, the identifier returned by
  27.           ooooppppeeeennnn may be used to write to the  command's  input  pipe  or
  28.           read from its output pipe.
  29.  
  30.           The _a_c_c_e_s_s argument indicates the way in which the file  (or
  31.           command pipeline) is to be accessed.  It may take two forms,  |
  32.           either a string in the form that  would  be  passed  to  the  |
  33.           ffffooooppppeeeennnn library procedure or a list of POSIX access flags.  It  |
  34.           defaults to ``rrrr''.  In the first form _a_c_c_e_s_s may have any of  |
  35.           the following values:
  36.  
  37.           rrrr              Open the file for reading only; the file must
  38.                          already exist.
  39.  
  40.           rrrr++++             Open the file for both reading  and  writing;
  41.                          the file must already exist.
  42.  
  43.           wwww              Open the file for writing only.  Truncate  it
  44.                          if  it exists.  If it doesn't exist, create a
  45.                          new file.
  46.  
  47.           wwww++++             Open  the  file  for  reading  and   writing.
  48.                          Truncate  it  if  it  exists.   If it doesn't
  49.                          exist, create a new file.
  50.  
  51.           aaaa              Open the file for  writing  only.   The  file
  52.                          must   already   exist,   and   the  file  is
  53.                          positioned so that new data  is  appended  to
  54.                          the file.
  55.  
  56.           aaaa++++             Open the file for reading  and  writing.   If
  57.                          the  file  doesn't  exist, create a new empty
  58.                          file.  Set the initial  access  position   to
  59.                          the end of the file.
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/17/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      ooooppppeeeennnn((((nnnn))))                     TTTTccccllll ((((7777....0000))))                     ooooppppeeeennnn((((nnnn))))
  71.  
  72.  
  73.  
  74.           In the second form, _a_c_c_e_s_s consists of a list of any of  the  |
  75.           following  flags,  all  of  which  have  the  standard POSIX  |
  76.           meanings.  One of the flags must be either RRRRDDDDOOOONNNNLLLLYYYY, WWWWRRRROOOONNNNLLLLYYYY or  |
  77.           RRRRDDDDWWWWRRRR.                                                         |
  78.  
  79.           RRRRDDDDOOOONNNNLLLLYYYY                                                             ||
  80.                          Open the file for reading only.                |
  81.  
  82.           WWWWRRRROOOONNNNLLLLYYYY                                                             ||
  83.                          Open the file for writing only.                |
  84.  
  85.           RRRRDDDDWWWWRRRR                                                               ||
  86.                          Open the file for both reading and writing.    |
  87.  
  88.           AAAAPPPPPPPPEEEENNNNDDDD                                                             ||
  89.                          Set  the  file pointer to the end of the file  |
  90.                          prior to each write.                           |
  91.  
  92.           CCCCRRRREEEEAAAATTTT                                                              ||
  93.                          Create  the  file if it doesn't already exist  |
  94.                          (without this flag it is  an  error  for  the  |
  95.                          file not to exist).                            |
  96.  
  97.           EEEEXXXXCCCCLLLL                                                               ||
  98.                          If  CCCCRRRREEEEAAAATTTT  is  specified  also,  an  error is  |
  99.                          returned if the file already exists.           |
  100.  
  101.           NNNNOOOOCCCCTTTTTTTTYYYY                                                             ||
  102.                          If  the  file is a terminal device, this flag  |
  103.                          prevents   the   file   from   becoming   the  |
  104.                          controlling terminal of the process.           |
  105.  
  106.           NNNNOOOONNNNBBBBLLLLOOOOCCCCKKKK                                                           ||
  107.                          Prevents  the  process  from  blocking  while  |
  108.                          opening the file.  For details refer to  your  |
  109.                          system   documentation  on  the  ooooppppeeeennnn  system  |
  110.                          call's OOOO____NNNNOOOONNNNBBBBLLLLOOOOCCCCKKKK flag.                        |
  111.  
  112.           TTTTRRRRUUUUNNNNCCCC                                                              ||
  113.                          If  the  file  exists it is truncated to zero  |
  114.                          length.                                        |
  115.  
  116.           If a new file is created as part of opening it,  _p_e_r_m_i_s_s_i_o_n_s  |
  117.           (an integer) is used to set the permissions for the new file  |
  118.           in conjunction with the process's file mode  creation  mask.  |
  119.           _P_e_r_m_i_s_s_i_o_n_s defaults to 0666.
  120.  
  121.           If a file is opened for both reading and writing  then  sssseeeeeeeekkkk
  122.           must  be  invoked  between a read and a write, or vice versa
  123.           (this restriction does not apply to command pipelines opened
  124.           with  ooooppppeeeennnn).  When _f_i_l_e_N_a_m_e specifies a command pipeline and
  125.           a write-only access is used, then standard output  from  the
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 7/17/95)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      ooooppppeeeennnn((((nnnn))))                     TTTTccccllll ((((7777....0000))))                     ooooppppeeeennnn((((nnnn))))
  137.  
  138.  
  139.  
  140.           pipeline  is  directed to the current standard output unless
  141.           overridden  by  the  command.   When  _f_i_l_e_N_a_m_e  specifies  a
  142.           command  pipeline  and  a  read-only  access  is  used, then
  143.           standard input from the pipeline is taken from  the  current
  144.           standard input unless overridden by the command.
  145.  
  146.  
  147.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  148.           access mode, append,  controlling  terminal,  create,  file,
  149.           non-blocking, open, permissions, pipeline, process
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                          (printed 7/17/95)
  196.  
  197.  
  198.  
  199.